import Vue from 'vue'
import Router from 'vue-router'
import Index from './Index.vue'
import Home from './Home.vue'
import Classify from './Classify.vue'
import Tag from './Tag.vue'
import File from './File.vue'
import About from './About.vue'
import Message from './Message.vue'
import FriendChain from './FriendChain.vue'


Vue.use(Router)

//路由导航冗余报错（路由重复）
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  routes: [
    {
      path:'/',
      redirect:'/index/home'
    },
    {
      path: '/index',
      name: 'index',
      component: Index,
      children:[
        {
          path:'home',
          component:Home
        },
        {
          path:'classify',
          component:Classify
        },
        {
          path:'tag',
          component:Tag
        },
        {
          path:'file',
          component:File
        },
        {
          path:'about',
          component:About
        },
        {
          path:'message',
          component:Message
        },
        {
          path:'friendChain',
          component:FriendChain
        }
      ]
    }
  ]
})
